#include <iostream>
#include <algorithm>
using namespace std;
const int N=1e5+10;
int n,a[N],b[N],k[N],top,ans,s;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]!=a[i-1]) top++;
        b[top]++;k[top]++;
    }

    s=2;
    while(s<=top&&!b[s]) s++;
    for(int i=1;i<=top;i++){
        if(s<=i) s=i+1;
        while(s<=top&&b[i]){
            b[i]--;k[s]--;
            while(s<=top&&!k[s]) s++;
            ans++;
            if(s>top) break;
        }
        if(s>top) break;
    }
    printf("%d",n-ans);
    return 0;
}
